// import { qrcodeSrc } from './qrcode-cfg';

const colorDict = {
  1: '#8994A9',
  2: '#E27B4A',
  3: '#5573F2',
  4: '#FF9400',
}

const boxHeight = 800; // 图片全局高度

export const mkQaPaintCfg = ({ count, level_info, score, qrcodeSrc }) => {
  console.log(count);
  const k = Math.ceil(score / 25) || 1;
  return {
    background: '#daf0fe',
    width: '620rpx',
    height: boxHeight + 'rpx',
    views: [
      // {
      //   type: 'image',
      //   url: '/subpages/questions/assets/sharebg.png',
      //   css: {
      //     width: '620rpx',
      //     height: boxHeight + 'rpx',
      //     left: 0,
      //     top: 0,
      //   }
      // },
      {
        type: 'rect',
        css: {
          color: '#fff',
          borderRadius: '20rpx',
          height: '410rpx',
          width: '550rpx',
          left: (620 - 550) / 2 + 'rpx',
          top: '100rpx',
        }
      },
      {
        type: 'image',
        url: `/assets/questions/icon0${k}.png`,
        css: {
          borderRadius: '16rpx 16rpx 0 0',
          width: '380rpx',
          height: '250rpx',
          left: (620 - 400) / 2 + 'rpx',
          top: (110 - 220 / 2) + 'rpx',
        }
      },
      {
        type: 'text',
        text: level_info.laodeng,
        css: {
          color: colorDict[k],
          textAlign: 'center',
          fontSize: '50rpx',
          width: '620rpx',
          top: '210rpx',
        }
      },
      {
        type: 'text',
        text: level_info.tip,
        css: {
          width: '450rpx',
          lineHeight: '44rpx',
          color: '#36404A',
          fontSize: '30rpx',
          left: (620 - 450) / 2 + 'rpx',
          top: 290 + 'rpx',
        }
      },
      {
        type: 'image',
        url: 'data:image/png;base64,' + qrcodeSrc, // `/assets/questions/icon0${k}.png`,
        css: {
          borderRadius: '8rpx',
          width: '80rpx',
          height: '80rpx',
          left: (620 - 550) / 2 + 'rpx',
          top: (boxHeight - 80 - 15) + 'rpx',
        }
      },
      {
        type: 'text',
        text: '长按识别小程序',
        css: {
          color: '#0956DB',
          fontSize: '23rpx',
          left: (620 - 450) / 2 + 'rpx',
          left: (620 - 550) / 2 + 80 + 16 + 'rpx',
          top: (boxHeight - 80 - 15 + 10) + 'rpx',
        }
      },
      {
        type: 'text',
        text: '与好友一起测测老登属性~',
        css: {
          color: '#0956DB',
          fontSize: '16rpx',
          left: (620 - 550) / 2 + 80 + 16 + 'rpx',
          top: (boxHeight - 80 - 15 + 50) + 'rpx',
        }
      },


    ]
  }
}